import React from "react";
import { Contexts } from "./context";

export default () => {
  const { state, dispatch } = Contexts();
  return (
    <div>
      app age is: {state?.age}
      <button
        type="button"
        onClick={() => {
          dispatch({
            type: "upgrade",
            payload: { age: state?.age - 1 },
          });
        }}
      >
        component age decre
      </button>
    </div>
  );
};
